#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>

using namespace std;

int get(int num, string s)
{
    int res = 0;
    for (auto c : s)
    {
        if (c - '0' != num)
            res++;
        num = !num;
    }
    return res;
}

//int minOperations(string s) {
//    return min(get(0, s), get(1, s));
//}

int minOperations(string s) {
    int cnt = 0;
    for (int i = 0; i < s.size(); i++)
    {
        char c = s[i];
        if (c != ('0' + i % 2))
            cnt++;
    }
    return min(cnt, (int)s.size() - cnt);
}